package com.example.bailin.giftsay.me;

import android.content.Intent;
import android.content.SharedPreferences;
import android.view.View;
import android.widget.Button;

import com.example.bailin.giftsay.R;
import com.example.bailin.giftsay.baseclass.BaseActivity;
import com.example.bailin.giftsay.tool.UrlProvide;

import cn.bmob.v3.BmobUser;

/**
 * Created by bailin on 16/9/1.
 */
public class ExitActivity extends BaseActivity implements View.OnClickListener {

    private SharedPreferences shared;

    @Override
    protected int setLayout() {
        return R.layout.activity_exit;
    }

    @Override
    protected void initView() {
        Button btn = bindView(R.id.btn_exitLogin);
        btn.setOnClickListener(this);
        shared = getSharedPreferences(UrlProvide.NAME, MODE_PRIVATE);
    }

    @Override
    protected void initData() {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_exitLogin:
//                BmobUser bmobUser = BmobUser.getCurrentUser(null);
//                bmobUser.logOut();
                SharedPreferences.Editor editor = shared.edit();
                editor.putString("username", "未登录");
                editor.apply();
                Intent intent = new Intent();
                setResult(911, intent);
                finish();
        }
    }
}
